using System.Collections.Generic;
using UnityEngine;
using Voodoo.Sauce.Internal;

namespace Voodoo.Sauce.Privacy
{
	public static class IdfaAuthorizationConfig
	{
		private const string TAG = "IdfaAuthorizationConfig";

		private static IdfaAuthorizationPopupLocalisation _popup;

		public static IdfaAuthorizationPopupLocalisation Popup
		{
			get
			{
				if (_popup == null)
				{
					_popup = Get<IdfaAuthorizationPopupLocalisation>(Application.systemLanguage);
				}
				return _popup;
			}
		}

		public static T Get<T>(SystemLanguage language, List<T> popupLocalisations = null) where T : IdfaAuthorizationAbstractPopupLocalisation, new()
		{
			VoodooLog.LogDebug(Module.VOODOO_TUNE, "IdfaAuthorizationConfig", "Get " + typeof(T).ToString() + " for " + language);
			T val = null;
			foreach (T popupLocalisation in popupLocalisations)
			{
				if (popupLocalisation.language == language.ToString())
				{
					val = popupLocalisation;
					break;
				}
			}
			if (val == null && language != SystemLanguage.English)
			{
				val = Get(SystemLanguage.English, popupLocalisations);
			}
			return val;
		}

		public static List<SystemLanguage> GetLanguages<T>() where T : IdfaAuthorizationAbstractPopupLocalisation, new()
		{
			return new List<SystemLanguage>();
		}
	}
}
